package com.ftg.learn.bus.sharecarexp_record.controller;

import com.ftg.learn.bus.sharecarexp_record.entity.SharecarExpRecord;
import com.ftg.learn.bus.sharecarexp_record.service.SharecarExpRecordService;
import com.ftg.learn.bus.util.ResultType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api(value = "公车费用记录",tags = "公车费用记录")
public class SharecarExpRecordController {

    @Autowired
    SharecarExpRecordService scurs;

    @ApiOperation(value = "公车费用记录表")
    @GetMapping("/showcarexp")
    public List<SharecarExpRecord> showAll(){
        return scurs.showAll();
    }

    @ApiOperation(value = "删除单条记录")
    @DeleteMapping("/deletecarexp")
    public int delete(String id){
        return scurs.delete(id);
    }

    @ApiOperation(value = "查一条记录")
    @PutMapping("/carexpfindone/{id}")
    public SharecarExpRecord findOne(@ApiParam("用车记录id") @PathVariable String id){
        return scurs.findOne(id);
    }

    @GetMapping("/showcarexp/modify&limit/{page}&{limit}&{sharecar_use_id}&{sharecar_use_operater}")
    @ApiOperation("模糊查询与分页")
    public ResultType<SharecarExpRecord> query(@ApiParam("总页数") @PathVariable int page, @ApiParam("每页条数") @PathVariable int limit, @ApiParam("用车费用id") @PathVariable String sharecar_expend_id, @ApiParam("操作人") @PathVariable String sharecar_expend_operater) {
        return scurs.query(page,limit,sharecar_expend_id,sharecar_expend_operater);
    }
}
